<?php
	include "dbconnect.php";
	$sem=$_POST["term"];
	$year=$_POST["year"];
	$con=mysql_connect($dbHost,$dbUserAndName,$dbPass);
	mysql_select_db($_DB_NAME,$con);
	$yearList =	mysql_query("select distinct year from semester where term like '%".$sem."%' and year like '%".$year."%' order by year desc");
	$year="";
	while($row = mysql_fetch_array($yearList))
	{
		if(empty($year)==true)
		{
  			$year= $row['year'];
		}
		else
		{
			$year= $year.",".$row['year'];
		}
	}
	mysql_close($con);	
	echo $year;
?>